import configparser
from settings.settings import Path, Route


class Config:
    def __init__(self):
        self.config = configparser.ConfigParser()

    def read(self, path, section, option):
        """
        :param path: 读取ini文件的位置（路径）
        :param section: ini文件的section
        :param option: ini文件的option
        :return: 返回读取section下的option
        """
        self.config.read(path, encoding='utf-8')
        sections = self.config.sections()
        print("文件中所有的sections：", sections)
        return self.config.get(section, option)


if __name__ == '__main__':
    c = Config()
    print(Config().read(Route().register_dataModels('dataModels_filename.ini'), 'testcase_filename', 'getToken'))
